<html>
<head> 
<meta charset="utf-8"> 
<title>GMProxy</title> 

</head>
<body>
<form id = "form1">
SIP服务器ID:  <input type="text" name="SIPServerID" placeholder="" id = "SIPServerID"><br>
SIP服务器域:  <input type="text" name="ServerSipDomain" placeholder="" id = "ServerSipDomain"><br>
SIP服务器地址:  <input type="text" name="SipServerIp" placeholder="" id = "SipServerIp"><br>
SIP服务器端口:  <input type="text" name="SipServerPort" placeholder="" id = "SipServerPort"><br>
SIP用户名:  <input type="text" name="SipUserName" placeholder="" id = "SipUserName"><br>
SIP用户认证ID:  <input type="text" name="DevideId" placeholder="" id = "DevideId"><br>
密码:  <input type="text" name="SipPassWd" placeholder="" id = "SipPassWd"><br>
密码确认:  <input type="text" name="ReSipPassWd" placeholder="" id = "SipPassWd"><br>
注册有效期:  <input type="text" name="Expires" placeholder="" id = "Expires"><br>
心跳周期:  <input type="text" name="SipHardExpires" placeholder="" id = "SipHardExpires"><br>
sip本地端口:  <input type="text" name="SipLocalPort" placeholder="" id = "SipLocalPort"><br>

<input type="submit" value="确定" id = "submit">
</form>
 
<p>点击"提交"按钮，表单数据将被发送到服务器上的“add”程序上。</p>

</body>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
 <script type="text/javascript">
 $("#submit").on("click",function(){
	var data = {};
	data["SIPServerID"] = $("#form1 input:eq(0)").val();
	data["ServerSipDomain"] = $("#form1 input:eq(1)").val();
	data["SipServerIp"] = $("#form1 input:eq(2)").val();
	data["SipServerPort"] = $("#form1 input:eq(3)").val();
	data["SipUserName"] = $("#form1 input:eq(4)").val();
	data["DevideId"] = $("#form1 input:eq(5)").val();
	data["SipPassWd"] = $("#form1 input:eq(6)").val();
	data["ReSipPassWd"] = $("#form1 input:eq(7)").val();
	data["Expires"] = $("#form1 input:eq(8)").val();
	data["SipHardExpires"] = $("#form1 input:eq(9)").val();
	data["SipLocalPort"] = $("#form1 input:eq(10)").val();
	$.ajax({
            //几个参数需要注意一下
                type: "POST",//方法类型
				contentType:'application/json;charset=UTF-8',
                dataType: "json",//预期服务器返回的数据类型
                url:"gmproxy/setGB28181config" ,//url
                data:JSON.stringify(data),
                success: function (result) {
					$("#ans").text(result.ans);
                    console.log(result.ans);//打印服务端返回的数据(调试用)
                    if (result.resultCode == 200) {
                        alert("SUCCESS");
                    };
                },
                error : function() {
                    alert("异常！");
                }
            });
	return false;
	})
    </script>
</html>
